<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Returns the status of working copy files and directories</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.svn-status" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">svn_status</h1>
  <p class="verinfo">(PECL svn &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">svn_status</span> &mdash; <span class="dc-title">Returns the status of working copy files and directories</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.svn-status-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>svn_status</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$path</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code><span class="initializer"> = 0</span></span>
  ] ) : <span class="type">array</span></div>

  <p class="para rdfs-comment">
   Returns the status of working copy files and directories, giving modifications,
   additions, deletions and other changes to items in the working copy.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.svn-status-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">path</code></dt>

     <dd>

      <p class="para">
       Local path to file or directory to retrieve status of.
      </p>
      <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">相对路径将会以PHP执行文件所在目录作为当前工作目录进行解析。如果希望依据脚本所在目录解析, 使用<span class="function"><a href="realpath.html" class="function">realpath()</a></span> 或 dirname(__FILE__)。</span></p></blockquote>
     </dd>

    
    
     <dt>
<code class="parameter">flags</code></dt>

     <dd>

      <p class="para">
       Any combination of <strong><code>Svn::NON_RECURSIVE</code></strong>,
       <strong><code>Svn::ALL</code></strong> (regardless of modification status),
       <strong><code>Svn::SHOW_UPDATES</code></strong> (entries will be added for items
       that are out-of-date), <strong><code>Svn::NO_IGNORE</code></strong> (disregard
       <em>svn:ignore</em> properties when scanning for new files)
       and <strong><code>Svn::IGNORE_EXTERNALS</code></strong>.
      </p>
     </dd>

    
   </dl>

  </p>

 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.svn-status-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns a numerically indexed array of associative arrays detailing
   the status of items in the repository:
  </p>
  <div class="example-contents screen">
<div class="returnvaluescode"><pre class="returnvaluescode">Array (
    [0] =&gt; Array (
        // information on item
    )
    [1] =&gt; ...
)</pre>
</div>
  </div>
  <p class="para">
   The information on the item is an associative array that can contain
   the following keys:
  </p>
  <dl>

   
    <dt>
<var class="varname"><var class="varname">path</var></var></dt>

     <dd>

      <span class="simpara">
       String path to file/directory of this entry on local filesystem.
      </span>
     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">text_status</var></var></dt>

     <dd>

      <span class="simpara">
       Status of item&#039;s text. 参见 <a href="svn.constants.html#svn.constants.status" class="link">状态常量列表</a> 获得可能的值.
      </span>
     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">repos_text_status</var></var></dt>

     <dd>

      <span class="simpara">
       Status of item&#039;s text in repository. Only accurate if
       <code class="parameter">update</code> was set to <strong><code>TRUE</code></strong>.
       参见 <a href="svn.constants.html#svn.constants.status" class="link">状态常量列表</a> 获得可能的值.
      </span>
     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">prop_status</var></var></dt>

     <dd>

      <span class="simpara">
       Status of item&#039;s properties. 参见 <a href="svn.constants.html#svn.constants.status" class="link">状态常量列表</a> 获得可能的值.
      </span>
     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">repos_prop_status</var></var></dt>

     <dd>

      <span class="simpara">
       Status of item&#039;s property in repository. Only accurate if
       <code class="parameter">update</code> was set to <strong><code>TRUE</code></strong>. 参见 <a href="svn.constants.html#svn.constants.status" class="link">状态常量列表</a> 获得可能的值.
      </span>
     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">locked</var></var></dt>

     <dd>

      <span class="simpara">
       Whether or not the item is locked. (Only set if <strong><code>TRUE</code></strong>.)
      </span>
     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">copied</var></var></dt>

     <dd>

      <span class="simpara">
       Whether or not the item was copied (scheduled for addition with
       history). (Only set if <strong><code>TRUE</code></strong>.)
      </span>
     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">switched</var></var></dt>

     <dd>

      <span class="simpara">
       Whether or not the item was switched using the switch command.
       (Only set if <strong><code>TRUE</code></strong>)
      </span>
     </dd>

   
  </dl>

  <p class="para">
   These keys are only set if the item is versioned:
  </p>
  <dl>

   
    <dt>
<var class="varname"><var class="varname">name</var></var></dt>

     <dd>

      <span class="simpara">
       Base name of item in repository.
      </span>
     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">url</var></var></dt>

     <dd>

      <span class="simpara">
       URL of item in repository.
      </span>
     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">repos</var></var></dt>

     <dd>

      <span class="simpara">
       Base URL of repository.
      </span>
     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">revision</var></var></dt>

     <dd>

      <span class="simpara">
       Integer revision of item in working copy.
      </span>
     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">kind</var></var></dt>

     <dd>

      <span class="simpara">
       Type of item, i.e. file or directory. 参见 <a href="svn.constants.html#svn.constants.type" class="link">类型常量列表</a> 获取可能的值.
      </span>
     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">schedule</var></var></dt>

     <dd>

      <span class="simpara">
       Scheduled action for item, i.e. addition or deletion. Constants
       for these magic numbers are not available, they can
       be emulated by using:
      </span>
       <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">if&nbsp;(!</span><span style="color: #0000BB">defined</span><span style="color: #007700">(</span><span style="color: #DD0000">'svn_wc_schedule_normal'</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">define</span><span style="color: #007700">(</span><span style="color: #DD0000">'svn_wc_schedule_normal'</span><span style="color: #007700">,&nbsp;&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;nothing&nbsp;special<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">define</span><span style="color: #007700">(</span><span style="color: #DD0000">'svn_wc_schedule_add'</span><span style="color: #007700">,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;item&nbsp;will&nbsp;be&nbsp;added<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">define</span><span style="color: #007700">(</span><span style="color: #DD0000">'svn_wc_schedule_delete'</span><span style="color: #007700">,&nbsp;&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;item&nbsp;will&nbsp;be&nbsp;deleted<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">define</span><span style="color: #007700">(</span><span style="color: #DD0000">'svn_wc_schedule_replace'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;item&nbsp;will&nbsp;be&nbsp;added&nbsp;and&nbsp;deleted<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
      </div>

     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">deleted</var></var></dt>

     <dd>

      <span class="simpara">
       Whether or not the item was deleted, but parent revision lags
       behind. (Only set if <strong><code>TRUE</code></strong>.)
      </span>
     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">absent</var></var></dt>

     <dd>

      <span class="simpara">
       Whether or not the item is absent, that is, Subversion knows that
       there should be something there but there isn&#039;t. (Only set if
       <strong><code>TRUE</code></strong>.)
      </span>
     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">incomplete</var></var></dt>

     <dd>

      <span class="simpara">
       Whether or not the entries file for a directory is incomplete.
       (Only set if <strong><code>TRUE</code></strong>.)
      </span>
     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">cmt_date</var></var></dt>

     <dd>

      <span class="simpara">
       Integer Unix timestamp of last commit date. (Unaffected by <code class="parameter">update</code>.)
      </span>
     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">cmt_rev</var></var></dt>

     <dd>

      <span class="simpara">
       Integer revision of last commit. (Unaffected by <code class="parameter">update</code>.)
      </span>
     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">cmt_author</var></var></dt>

     <dd>

      <span class="simpara">
       String author of last commit. (Unaffected by <code class="parameter">update</code>.)
      </span>
     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">prop_time</var></var></dt>

     <dd>

      <span class="simpara">
       Integer Unix timestamp of last up-to-date time for properties
      </span>
     </dd>

   
   
    <dt>
<var class="varname"><var class="varname">text_time</var></var></dt>

     <dd>

      <span class="simpara">
       Integer Unix timestamp of last up-to-date time for text
      </span>
     </dd>

   
   
  </dl>

 </div>


 <div class="refsect1 notes" id="refsect1-function.svn-status-notes">
  <h3 class="title">注释</h3>
  <div class="warning"><strong class="warning">Warning</strong><p class="simpara">此函数是<em class="emphasis">实验性</em>的。此函数的表象，包括名称及其相关文档都可能在未来的
PHP 发布版本中未通知就被修改。使用本函数风险自担 。</p></div>
 </div>


 

 

 <div class="refsect1 examples" id="refsect1-function.svn-status-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5676">
    <p><strong>Example #1 Basic example</strong></p>
    <div class="example-contents"><p>
     This example demonstrates a basic, theoretical usage of this function.
    </p></div>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">svn_status</span><span style="color: #007700">(</span><span style="color: #0000BB">realpath</span><span style="color: #007700">(</span><span style="color: #DD0000">'wc'</span><span style="color: #007700">)));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Array (
    [0] =&gt; Array (
        [path] =&gt; /home/bob/wc/sandwich.txt
        [text_status] =&gt; 8 // item was modified
        [repos_text_status] =&gt; 1 // no information available, use update
        [prop_status] =&gt; 3 // no changes
        [repos_prop_status] =&gt; 1 // no information available, use update
        [name] =&gt; sandwich.txt
        [url] =&gt; http://www.example.com/svnroot/deli/trunk/sandwich.txt
        [repos] =&gt; http://www.example.com/svnroot/
        [revision] =&gt; 123
        [kind] =&gt; 1 // file
        [schedule] =&gt; 0 // no special actions scheduled
        [cmt_date] =&gt; 1165543135
        [cmt_rev] =&gt; 120
        [cmt_author] =&gt; Alice
        [prop_time] =&gt; 1180201728
        [text_time] =&gt; 1180201729
    )
)
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.svn-status-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="svn_update.html" class="function" rel="rdfs-seeAlso">svn_update()</a> - Update working copy</span></li>
    <li class="member"><span class="function"><a href="svn_log.html" class="function" rel="rdfs-seeAlso">svn_log()</a> - Returns the commit log messages of a repository URL</span></li>
    <li class="member"><a href="http://svnbook.red_bean.com/en/1.2/svn.ref.svn.c.status.html" class="link external">&raquo;&nbsp;SVN documentation for svn status</a></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>